clear

import 	delimited ".\input\NPIs_markel\npi_info_markel_et_al_geotagged.csv"

drop 	lat lon decade nhgisnam nhgisst nhgiscty icpsrst icpsrcty icpsrnam ///
			statenam icpsrsti icpsrctyi icpsrfip state_1 county gisjoin cz area

rename dateoffirstnonpharmaceuticalinte dateoffirstnpi
			
foreach v of varlist firstcasedate mortalityaccelerationdate dateoffirstnpi dateofpeakexcessdeathrate {
	replace `v' = `v'+"-1918"
	gen 	`v'_mr = date(`v',"DMY") 
}
			
rename	firstcasedate_mr 				d_firstcase
rename	mortalityaccelerationdate_mr 	d_mortaccel
rename	dateoffirstnpi_mr 				d_firstnpi
rename	dateofpeakexcessdeathrate_mr 	d_peakdeaths
			
format 	d_* %td

drop 	firstcasedate mortalityaccelerationdate dateoffirstnpi dateofpeakexcessdeathrate

order 	npi_id city d_*, first


rename	publichealthresponsetimed 			ph_responsetime
rename	totalnoofdaysofnonpharmaceutical 	days_npis
rename	timetopeakd 						days_topeakdeaths
rename	magnitudeoffirstpeakexcessdeaths 	mag_firstexcessdeaths
rename	excesspneumoniaandinfluenzamorta	mag_maxexcessdeaths

compress 
save 	"./output/intermediate/npis", replace

clear
